var TIANQICHIDU={
	mod:{
		main:null
	},
	reloadData:null,
	init:function(){
		var _this = this;
		_this.mod.main.init();
		_this.reloadData = _this.mod.main._reloadData;
	}
};

var tqimgs =[
           	{"src":"3feng",selfdisabled:'all',style:'color:#FF8000',type:'WIND',id:'sanjifeng',title:'三级风'},	
           	{"src":"4feng",selfdisabled:'all',style:'color:#FF8000',type:'WIND',id:'sijifeng',title:'四级风'},	
           	{"src":"5feng",selfdisabled:'all',style:'color:#FF8000',type:'WIND',id:'wujifeng',title:'五级风'},
           	{"src":"6feng",selfdisabled:'all',style:'color:#FF8000',type:'WIND',id:'liujifeng',title:'六级风'},	
           	
           	{"src":"7feng",selfdisabled:'all',style:'color:#FF8000',type:'WIND',id:'qijifeng',title:'七级风'},
           	{"src":"8feng",selfdisabled:'all',style:'color:#FF8000',type:'WIND',id:'bajifeng',title:'八级风'},	
           	{"src":"9feng",selfdisabled:'all',style:'color:#FF8000',type:'WIND',id:'jiujifeng',title:'九级风'},	
           	{"src":"10feng",selfdisabled:'all',style:'color:#FF8000',type:'WIND',id:'shijifeng',title:'十级风'},	
           	
           	{"src":"11feng",selfdisabled:'all',style:'color:#FF8000',type:'WIND',id:'shiyijifeng',title:'十一级风'},	
           	{"src":"12feng",selfdisabled:'all',style:'color:#FF8000',type:'WIND',id:'shierjifeng',title:'十二级风'},
           	{"src":"jingfeng",selfdisabled:'all',style:'color:#FF8000',id:'jingfeng',type:'POINT',title:'静风'},	
           	{"src":"xiaoyu",selfdisabled:'all',style:'color:#00ff00',type:'POINT',typeTrue:'XIAOYU',id:'xiaoyu',title:'小雨'},	
           	
           	{"src":"zhongyu",selfdisabled:'all',style:'color:#00ff00',type:'POINT',id:'zhongyu',title:'中雨'},
           	{"src":"dayu", selfdisabled:'all',style:'color:#00ff00',type:'POINT',id:'dayu',title:'大雨'},	
           	{"src":"baoyu",selfdisabled:'all',style:'color:#00ff00',type:'POINT',id:'baoyu',title:'暴雨'},
           	{"src":"dabaoyu",selfdisabled:'all',style:'color:#00ff00',type:'POINT',id:'dabaoyu',title:'大暴雨'},	
           	
           	{"src":"tedabaoyu",selfdisabled:'all',style:'color:#00ff00',type:'POINT',id:'tedabaoyu',title:'特大暴雨'},	
           	{"src":"zhenyu",selfdisabled:'all',style:'color:#00ff00',type:'POINT',id:'zhenyu',title:'阵雨'},	
           	{"src":"xiaoxue",selfdisabled:'all',style:'color:#00ff00',type:'POINT',type:'POINT',id:'xiaoxue',title:'小雪'},
           	{"src":"yujiaxue",selfdisabled:'all',style:'color:#00ff00',type:'POINT',id:'yujiaxue',title:'雨夹雪'},
           	
           	{"src":"zhongxue",selfdisabled:'all',style:'color:#00ff00',type:'POINT',id:'zhongxue',title:'中雪'},	
           	{"src":"daxue", selfdisabled:'all',style:'color:#00ff00',type:'POINT',id:'daxue',title:'大雪'},	
           	{"src":"baoxue",selfdisabled:'all',style:'color:#00ff00',type:'POINT',id:'baoxue',title:'暴雪'},	
           	{"src":"zhenxue",selfdisabled:'all',style:'color:#00ff00',type:'POINT',id:'zhenxue',title:'阵雪'},
           	
           	{"src":"qindongyu",selfdisabled:'all',style:'color:#FF0000',type:'POINT',id:'qingdongyu',title:'轻冻雨'},
           	{"src":"dongyu",selfdisabled:'all',style:'color:#FF0000',type:'POINT',id:'dongyu',title:'冻雨'},	
           	{"src":"fuchen", selfdisabled:'all',style:'color:#FF0000',type:'POINT',id:'fuchen',title:'浮尘'},
           	{"src":"yangsha",selfdisabled:'all',style:'color:#FF0000',type:'POINT',id:'yangsha',title:'扬沙'},	
           	 
           	{"src":"shabao",selfdisabled:'all',style:'color:#FF0000',type:'POINT',id:'shachenbao',title:'沙尘暴'},
           	{"src":"qinshabao",selfdisabled:'all',style:'color:#FF0000',type:'POINT', id:'qingshachenbao',title:'轻沙暴'},
           	{"src":"qingtian",selfdisabled:'all',style:'color:#80FFFF',type:'POINT',id:'qingtian',title:'晴天'},	
           	{"src":"yintian",selfdisabled:'all',style:'color:#80FFFF',type:'POINT',id:'yintian',title:'阴天'},	
           	
           	{"src":"duoyun",selfdisabled:'all',style:'color:#80FFFF',type:'POINT',id:'duoyun',title:'多云'},
           	{"src":"qingwu",selfdisabled:'all',style:'color:#FF8000',id:'qingwu',type:'POINT',title:'轻雾'},	
           	{"src":"wu",selfdisabled:'all',style:'color:#FF8000',type:'POINT',id:'wu',title:'雾'},
           	{"src":"bingbao",selfdisabled:'all',style:'color:#0080C0',type:'POINT',id:'bingbao',title:'冰雹'},	
           	
           	
           	
           	{"src":"shuangdong",selfdisabled:'all',style:'color:#80FFFF',type:'POINT',id:'shuangdong',title:'霜冻'},	
           	{"src":"leibao",selfdisabled:'all',style:'color:#FF0000',id:'leibao',type:'POINT',title:'雷暴'},	
           	{"src":"xuanzhuanfeng",selfdisabled:'all',style:'color:#FF8000',id:'xuanzhuanfeng',type:'WIND',title:'旋转风'},
           	{"src":"taifeng",selfdisabled:'all',style:'color:#FF0000',id:'taifeng',type:'POINT',title:'台风'},
           	{"src":"shuangdongxian",selfdisabled:'SelfStyleColorAndWidth',style:'color:#FF0000',id:'creamLine',title:'霜冻线',type:'SSX',typeTrue:'SHUANGDONGXIAN'},
           	{"src":"gaodiyazhongxinG",selfdisabled:'all',style:'color:#80FFFF',type:'POINT',typeTrue:'GAODIZHIZHONGXIN',id:'gaodizhizhongxin',title:'高值中心'},
           	{"src":"gaodiyazhongxinD",selfdisabled:'all',style:'color:#80FFFF',type:'POINT',typeTrue:'GAODIZHIZHONGXIN',id:'gaodizhizhongxinD',title:'低值中心'},
           	{"src":"lengnuanzhongxinN",selfdisabled:'all',style:'color:#FF0000',type:'POINT',typeTrue:'LENGNUANZHONGXIN',id:'lengnuanzhongxin',title:'暖中心'},
           	{"src":"lengnuanzhongxinL",selfdisabled:'all',style:'color:#FF0000',type:'POINT',typeTrue:'LENGNUANZHONGXIN',id:'lengnuanzhongxinL',title:'冷中心'},
           	{"src":"35duwenduxian",style:'color:#FF0000',id:'swwdx',selfdisabled:'SelfStyleColorAndWidth',selfDefineStyle:'shixian',type:'ECTVALUE_LINE',title:'35度温度线'},
           	{"src":"tianchongquyu",style:'color:#00ff00',strokeColor:'red',id:'tcqy',type:'BEZIER_POLYGON',typeTrue:'TIANCHONGQUYU',selfdisabled:'SelfStyleColorAndWidth',title:'填充区域',fillCo:'true'},
           	{"src":"caoxian",selfdisabled:'all',style:'color:#A52A2A',selfDefineStyle:'shixian',type:'BEZIER_CURVE',id:'caoxianClick1',title:'槽线'},
           	 
           	{"src":"nuanfeng",style:'color:#FF0000',selfDefineStyle:'shixian',type:'WORM',id:'wormClick1',title:'暖风',selfdisabled:'all'},
           	{"src":"lf",style:'color:#0000FF',selfDefineStyle:'shixian',type:'COLD',id:'coldClick1',title:'冷风',selfdisabled:'all'},
           	{"src":"guqiufeng",style:'color:#FF0000',selfDefineStyle:'shixian',type:'GQF',id:'gqfClick1',title:'锢囚锋',selfdisabled:'all'},
           	{"src":"jingzhifeng",style:'color:#0000FF',selfdisabled:'all',selfDefineStyle:'shixian',type:'JZF',id:'jzfClick1',title:'静止锋'},
           	{"src":"jiantou",style:'color:#26AAD3',id:'jiantouClick',title:'箭头',type:'DXJT',typeTrue:'JIANTOU',selfdisabled:'SelfStyleColorAndWidth'},
           	{"src":"shuangshixian",selfdisabled:'SelfStyleColorAndWidth',style:'color:#00B4FF',id:'shuangshixianClick',type:'SSX',typeTrue:'SHUANGSHIXIAN',title:'双实线'},
           	{"src":"bihexian",style:'color:#EA00EB',selfDefineStyle:'shixian',type:'BEZIER_CURVE',id:'bihexianClick',title:'闭合线',selfdisabled:'SelfStyle'},
           	{"src":"biaozhuquyu",style:'color:#00ff00',strokeColor:'red',id:'tcqy',type:'BEZIER_POLYGON',typeTrue:'TIANCHONGQUYU',selfdisabled:'SelfStyleColorAndWidth',title:'带标注填充区域','biaozhu':true,fillCo:'true'},
           	
           	];

TIANQICHIDU.mod.main = {
		_reloadData:null,
		init:function(){
			var _this = this;
			_this.initTable();
			
			$(".div-bottom div").bind("click",function(){
				
				$(".div-bottom div").css("background-color","");
				$(".div-bottom div").css("background-image","");
				$(this).css("background-color","#3d597c");
				
				//小图片恢复原来的样式
				$(".zcditem_tqcd div").css("background-color","");
				var clazz = $(this).attr("class");
				var url = "http://10.226.120.112:8091/business/common/css/images/zcd/";
				if(clazz == "hand_1"){
					$(this).css("background-image","url("+url+"hand02.png) ");
				}else if(clazz == "hand_2"){
					$(this).css("background-image","url("+url+"copy02.png) ");
				}else if(clazz == "hand_3"){
					$(this).css("background-image","url("+url+"move02.png) ");
				}else if(clazz == "hand_4"){
					$(this).css("background-image","url("+url+"trash02.png) ");
				}else if(clazz == "hand_5"){
					$(this).css("background-image","url("+url+"erase02.png) ");
				}else if(clazz == "hand_6"){
					$(this).css("background-image","url("+url+"back02.png) ");
				}else if(clazz == "hand_7"){
					$(this).css("background-image","url("+url+"next02.png) ");
				}
			});
			//GIS.Common.deactiveTool();
		},
		initTable:function(){
			var _this = this;
			_this.initTop();
		},
		//画上面部分的图片
		initTop:function(){
			var html = "";
			for(var i =0;i<tqimgs.length;i++){
				var src = 'http://10.226.120.112:8091/business/common/css/images/zcd/'+tqimgs[i].src+".png";
				var $div = $('<div></div>').attr(tqimgs[i]).on('click',function(){
					var $this=$(this);
					//drawSvgGis.svg.tianqizhongchiObj2 =$this;
					changeColorAndText($this); 
					judgeFontAndThickness($this);
					/**GIS.Common.deactiveTool();
					drawSvgGis.svg.scaleClick(this,function(data){
						zcdShowModal(data);
					});*/
                    scaleClick(this);
					$(".zcditem_tqcd div").css("background-color","");
					$(this).css("background-color","#445364");
					$('#toolArea').children('div').css("background-image","").css("background-color","");
					//小助手恢复原来的样式
					$(".div-bottom div").css("background-color","").css("background-image","");
					$("#space").attr('data-flag','0');
					$("#juli").attr('data-flag','0');
				});
				str = $div.attr('style',$div.attr('style')+';'+'background-image: url('+src+')');
				$(".zcditem_tqcd").append($div); 
			}
		}
};

function changeColorAndText($obj){
	var color = $obj.css('color');
	color= Raphael.color(color).hex;
	$('.scale_color').prop('value',color);
	if($obj.fillColor){
		
	}
	$('#selWram').html($obj.attr('title'));
}

function judgeFontAndThickness($obj){
	var style1='width: 101%;position:absolute;height: 101%;z-index: 9999;background-color: rgba(168, 168, 148, 0.32)';
	var style2 = 'display:none';
	if($obj.attr('selfdisabled')=='all'){
		$('#eleDetail_warp_zhezhao').attr('style',style1);
	}else{ 
		$('#eleDetail_warp_zhezhao').attr('style',style2);
	}
	if($obj.attr('selfdisabled')=='SelfStyleColorAndWidth'){
		$("#svgselect").attr('disabled','disabled');
	}
	else
	{
		if($("#svgselect").attr('disabled'))
		{
			$("#svgselect").removeAttr('disabled');
		}	
	}
}

function zcdShowModal($obj){
	var isE = $('#modal_zcdShowModal').length;
	var ifShow =$('#modal_zcdShowModal').css("display");
	if(ifShow=="none" || ifShow === undefined){
		if(isE<=0){
			$.modal.show({
				id : "zcdShowModal",// modalId
				title : "中尺度图例",// 弹出框标题
				m_top : 200,//上边距
				m_bottom : 200,//下边距
				m_left : 484,//右边距
				width : 220,// 弹出框宽度
				height : 300,// 弹出框宽度
				hide: true,
				backdrop : false,// 是否遮罩
				closeTip : true,// 是否需要关闭按钮
				size : 'small'
			});
		}
		$('#modal_zcdShowModal').css("display","block");
	}
	$("#modal_zcdShowModal .modal-body").empty();
	if(!($obj==null || $.isEmptyObject($obj))){
		for(var i in $obj){
			var src ='http://10.226.120.112:8091/business/common/css/images/zcd/'+$obj[i].src+".png";
			var isF = $('#modal_zcdShowModal .modal-body div[title='+i+']').length;
			if(isF<=0){
				var html = '<div title='+i+' style="width:101px;height:28px;overflow: hidden;float:left;margin:4px 0;">';
				html += '<img src='+src+' style="float: left;width:24px;height:24px;margin: 2px;">';
				html += '<span style="float: left;width:65px;height:24px;overflow-x:hidden; margin: 2px;text-overflow: ellipsis;white-space: nowrap;">'+i+'</span></div>';
				$("#modal_zcdShowModal .modal-body").append(html);
			}
		}
	}else{
		$('#modal_zcdShowModal').css("display","none");
	}
}

function zcdClean(){
	$("#modal_zcdShowModal .modal-body").empty();
	$('#modal_zcdShowModal').css("display","none");
}
function zcdSave(){
	setTimeout(()=>{
		alert("保存成功");
	},2000)
}